package com.meitun.mama.ui.main;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.meitun.mama.R;
import com.meitun.mama.inject.InjectData;
import com.meitun.mama.inject.InjectView;
import com.meitun.mama.ui.BaseFragment;
import com.meitun.mama.widget.TestTextView;

/**
 * Created by sunny01 on 2016/3/27.
 */
public class TestFragment extends BaseFragment {

    @InjectData
    private String test = "unkonw";
    @InjectView(R.id.test)
    private TestTextView textView;

    @Override
    protected int getLayoutId() {
        return R.layout.test;
    }

    @Override
    protected void intitBundle(Bundle savedInstanceState) {
        test = savedInstanceState.getString("test");
    }

    @Override
    protected void initView() {
        super.initView();
        textView.setText(test);
        textView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
//                gotoPage();
            }
        });
    }

    private void gotoPage() {
        Intent intent = new Intent(Intent.ACTION_VIEW);
        Uri uri = Uri.parse("test://common");
        intent.setData(uri);
        startActivity(intent);
    }

    @Override
    public void onResume() {
        super.onResume();
        initView();
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return super.onCreateView(inflater, container, savedInstanceState);
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

    }
}
